$(document).ready(function(){
    
    mzpost({
        url:pub_prom_list,
        data:{},
        success:function(res){
            if(res.code == '2000'){
               var data = res.data;
               createTGDom(data);
            }else{
                mui.toast('获取推广课堂失败');
            }
        },
        error:function(err){
            mui.toast('获取推广课堂错误');
        }
    })


})
function createTGDom(data){
    if(data instanceof Array && data.length > 0){
        $('#list').empty();
        $.each(data,function(i,item){
            $('<li class="mui-table-view-cell mui-media">'+
            '<a href="./detail/index.html?id='+item.id+'">'+
               '<img class="mui-media-object mui-pull-left" src="'+item.img.replace(/\\/g,'')+'">'+
                '<div class="mui-media-body">'+
                    '<span>'+item.title+'</span>'+
                    '<p class="mui-ellipsis">'+item.description+'</p>'+
                '</div>'+
            '</a>'+
            '</li>').appendTo('#list');
        })

    }else{
        mui.toast('无课堂信息')
    }
}